package com.slipper.system.message.controller;

import com.slipper.system.message.bo.MessageStatusBO;
import com.slipper.system.message.service.MessageStatusService;
import com.slipper.util.ResultUtil;
import com.slipper.util.Tool;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/system/messageStatus")
public class MessageStatusController {
    @Resource
    private MessageStatusService messageStatusService;
    
    @PostMapping(value = "/queryBy")
    public String queryBy(@RequestBody MessageStatusBO bo) {
        if(Tool.isBlank(bo.getId())) {
            return ResultUtil.failureResult("数据获取失败！");
        }
        return ResultUtil.successResult(messageStatusService.queryBy(bo.getId()));
    }

    @PostMapping(value = "/queryList")
    public String queryList(@RequestBody MessageStatusBO bo) {
        return ResultUtil.successResult(messageStatusService.queryList(bo));
    }
    
    @PostMapping(value = "/queryPage")
    public String queryPage(@RequestBody MessageStatusBO bo) {
        return ResultUtil.successResult(messageStatusService.queryPage(bo));
    }

    @PostMapping(value = "/save")
    public String save(@RequestBody MessageStatusBO bo) {
        return ResultUtil.saveResult(messageStatusService.save(bo), bo);
    }

    @PostMapping(value = "/delete")
    public String delete(@RequestBody MessageStatusBO bo) {
        return ResultUtil.deleteResult(messageStatusService.delete(bo));
    }
}
